<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="schronisko.*,Users.*,java.sql.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Select</title>
<style>
body {
background: #d0f0f6;
}
#customers
{
font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
border-collapse:collapse;
}
#customers td, #customers th 
{
font-size:1em;
border:1px solid #98bf21;
padding:3px 7px 2px 7px;
}
#customers th 
{
font-size:1.1em;
text-align:left;
padding-top:5px;
padding-bottom:4px;
background-color:#A7C942;
color:#ffffff;
}
#customers tr.alt td 
{
color:#000000;
background-color:#EAF2D3;
}
</style>
</head>
<body>
<a href = "../admin/request.jsp"> Powrot do panelu</a><br><br>
<center>
<%
response.setContentType("text/html");
ResultSet r = (ResultSet)session.getAttribute("select_result");
if(r != null){
	ResultSetMetaData meta = r.getMetaData();
	int count = meta.getColumnCount();
%>
<table id="customers">
<tr>
<%
for(int i = 1; i <= count ; i++){
%>
<th width=200><% out.println(meta.getColumnName(i)); %></th>
<%
}
%>
</tr>
<%

int i = 1;

while(r.next()){
	int flag = 0;
	
	for(int j = 1; j <= count ; j++){
	if (i%2 == 1){
		if(flag == 0){
		out.print("<tr>");
		flag = 1;
	}
	out.print("<td>"+ r.getObject(j)+"</td>");
		}
	else {
		if(flag == 0) {
			out.print("<tr class='alt'>");
			flag = 1;
		}
		out.print("<td>"+ r.getObject(j) +"</td>");
	}
	
}
	i++;
	out.print("</tr>");
}

}
%>
</table>
</center>
</body>
</html>